package indiwood.model.dao;

import indiwood.model.ForumVO;

import java.util.List;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class ForumDAOImpl implements ForumDAO {
	@Resource(name = "sqlSessionTemplate")
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public List<ForumVO> ForumList(String pageNo) {

		return sqlSessionTemplate.selectList("forum.ForumList", pageNo);
	}

	@Override
	public int write(ForumVO fvo) {
		System.out.println(fvo);
		return sqlSessionTemplate.insert("forum.write", fvo);
	}

	@Override
	public ForumVO content(int no) {

		return sqlSessionTemplate.selectOne("forum.content", no);

	}

	@Override
	public void forumUpdate(ForumVO fvo) {
		sqlSessionTemplate.update("forum.forumUpdate", fvo);
	}

	@Override
	public void forumdelete(int no) {
		sqlSessionTemplate.delete("forum.forumdelete", no);
	}

	@Override
	public int totalContent() {
		return sqlSessionTemplate.selectOne("forum.totalContent");
	}

	@Override
	public void updateCount(int no) {
		System.out.println(no);
		sqlSessionTemplate.update("forum.updateCount", no);
	}

	@Override
	public String date(int no) {
		return sqlSessionTemplate.selectOne("forum.date", no);
	}

	

}
